<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Jetson Inference: Error Checking</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="NVLogo_2D.jpg"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Jetson Inference
   </div>
   <div id="projectbrief">DNN Vision Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('group__cudaError.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Error Checking<div class="ingroups"><a class="el" href="group__util.html">Utilities Library (jetson-utils)</a> &raquo; <a class="el" href="group__cuda.html">CUDA</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>Error checking and logging macros.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:ga5af54ef2b094a11a88feb67b327e1d19"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cudaError.html#ga5af54ef2b094a11a88feb67b327e1d19">CUDA</a>(x)&#160;&#160;&#160;<a class="el" href="group__cudaError.html#ga1bab99bd137e538276d8c75a12779f61">cudaCheckError</a>((x), #x, __FILE__, __LINE__)</td></tr>
<tr class="memdesc:ga5af54ef2b094a11a88feb67b327e1d19"><td class="mdescLeft">&#160;</td><td class="mdescRight">Execute a CUDA call and print out any errors.  <a href="group__cudaError.html#ga5af54ef2b094a11a88feb67b327e1d19">More...</a><br /></td></tr>
<tr class="separator:ga5af54ef2b094a11a88feb67b327e1d19"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga83cbda41b1503ffc548dadc3a10e12af"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cudaError.html#ga83cbda41b1503ffc548dadc3a10e12af">CUDA_SUCCESS</a>(x)&#160;&#160;&#160;(<a class="el" href="group__cudaError.html#ga5af54ef2b094a11a88feb67b327e1d19">CUDA</a>(x) == cudaSuccess)</td></tr>
<tr class="memdesc:ga83cbda41b1503ffc548dadc3a10e12af"><td class="mdescLeft">&#160;</td><td class="mdescRight">Evaluates to true on success.  <a href="group__cudaError.html#ga83cbda41b1503ffc548dadc3a10e12af">More...</a><br /></td></tr>
<tr class="separator:ga83cbda41b1503ffc548dadc3a10e12af"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad12b27627f04dd0ecf3eb9e2468a846e"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cudaError.html#gad12b27627f04dd0ecf3eb9e2468a846e">CUDA_FAILED</a>(x)&#160;&#160;&#160;(<a class="el" href="group__cudaError.html#ga5af54ef2b094a11a88feb67b327e1d19">CUDA</a>(x) != cudaSuccess)</td></tr>
<tr class="memdesc:gad12b27627f04dd0ecf3eb9e2468a846e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Evaluates to true on failure.  <a href="group__cudaError.html#gad12b27627f04dd0ecf3eb9e2468a846e">More...</a><br /></td></tr>
<tr class="separator:gad12b27627f04dd0ecf3eb9e2468a846e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga422e1f398e12cf567ed890a5b499eeef"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cudaError.html#ga422e1f398e12cf567ed890a5b499eeef">CUDA_VERIFY</a>(x)&#160;&#160;&#160;if(<a class="el" href="group__cudaError.html#gad12b27627f04dd0ecf3eb9e2468a846e">CUDA_FAILED</a>(x))	return false;</td></tr>
<tr class="memdesc:ga422e1f398e12cf567ed890a5b499eeef"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return from the boolean function if CUDA call fails.  <a href="group__cudaError.html#ga422e1f398e12cf567ed890a5b499eeef">More...</a><br /></td></tr>
<tr class="separator:ga422e1f398e12cf567ed890a5b499eeef"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae6c4176aa6f8270000ec2b626a2a8b3c"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cudaError.html#gae6c4176aa6f8270000ec2b626a2a8b3c">LOG_CUDA</a>&#160;&#160;&#160;&quot;[cuda]   &quot;</td></tr>
<tr class="memdesc:gae6c4176aa6f8270000ec2b626a2a8b3c"><td class="mdescLeft">&#160;</td><td class="mdescRight">LOG_CUDA string.  <a href="group__cudaError.html#gae6c4176aa6f8270000ec2b626a2a8b3c">More...</a><br /></td></tr>
<tr class="separator:gae6c4176aa6f8270000ec2b626a2a8b3c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga45dfaa21be9e387fa4eb41e0d9359c18"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cudaError.html#ga45dfaa21be9e387fa4eb41e0d9359c18">CUDA_FREE</a>(x)&#160;&#160;&#160;if(x != NULL) { cudaFree(x); x = NULL; }</td></tr>
<tr class="memdesc:ga45dfaa21be9e387fa4eb41e0d9359c18"><td class="mdescLeft">&#160;</td><td class="mdescRight">Check for non-NULL pointer before freeing it, and then set the pointer to NULL.  <a href="group__cudaError.html#ga45dfaa21be9e387fa4eb41e0d9359c18">More...</a><br /></td></tr>
<tr class="separator:ga45dfaa21be9e387fa4eb41e0d9359c18"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9994300b5165fde5b2043200309a5ed3"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cudaError.html#ga9994300b5165fde5b2043200309a5ed3">CUDA_FREE_HOST</a>(x)&#160;&#160;&#160;if(x != NULL) { cudaFreeHost(x); x = NULL; }</td></tr>
<tr class="memdesc:ga9994300b5165fde5b2043200309a5ed3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Check for non-NULL pointer before freeing it, and then set the pointer to NULL.  <a href="group__cudaError.html#ga9994300b5165fde5b2043200309a5ed3">More...</a><br /></td></tr>
<tr class="separator:ga9994300b5165fde5b2043200309a5ed3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga1bab99bd137e538276d8c75a12779f61"><td class="memItemLeft" align="right" valign="top">cudaError_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cudaError.html#ga1bab99bd137e538276d8c75a12779f61">cudaCheckError</a> (cudaError_t retval, const char *txt, const char *file, int line)</td></tr>
<tr class="memdesc:ga1bab99bd137e538276d8c75a12779f61"><td class="mdescLeft">&#160;</td><td class="mdescRight">cudaCheckError  <a href="group__cudaError.html#ga1bab99bd137e538276d8c75a12779f61">More...</a><br /></td></tr>
<tr class="separator:ga1bab99bd137e538276d8c75a12779f61"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Error checking and logging macros. </p>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="ga5af54ef2b094a11a88feb67b327e1d19"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5af54ef2b094a11a88feb67b327e1d19">&#9670;&nbsp;</a></span>CUDA</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define CUDA</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">x</td><td>)</td>
          <td>&#160;&#160;&#160;<a class="el" href="group__cudaError.html#ga1bab99bd137e538276d8c75a12779f61">cudaCheckError</a>((x), #x, __FILE__, __LINE__)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Execute a CUDA call and print out any errors. </p>
<dl class="section return"><dt>Returns</dt><dd>the original cudaError_t result </dd></dl>

</div>
</div>
<a id="gad12b27627f04dd0ecf3eb9e2468a846e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad12b27627f04dd0ecf3eb9e2468a846e">&#9670;&nbsp;</a></span>CUDA_FAILED</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define CUDA_FAILED</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">x</td><td>)</td>
          <td>&#160;&#160;&#160;(<a class="el" href="group__cudaError.html#ga5af54ef2b094a11a88feb67b327e1d19">CUDA</a>(x) != cudaSuccess)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Evaluates to true on failure. </p>

</div>
</div>
<a id="ga45dfaa21be9e387fa4eb41e0d9359c18"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga45dfaa21be9e387fa4eb41e0d9359c18">&#9670;&nbsp;</a></span>CUDA_FREE</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define CUDA_FREE</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">x</td><td>)</td>
          <td>&#160;&#160;&#160;if(x != NULL) { cudaFree(x); x = NULL; }</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Check for non-NULL pointer before freeing it, and then set the pointer to NULL. </p>

</div>
</div>
<a id="ga9994300b5165fde5b2043200309a5ed3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9994300b5165fde5b2043200309a5ed3">&#9670;&nbsp;</a></span>CUDA_FREE_HOST</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define CUDA_FREE_HOST</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">x</td><td>)</td>
          <td>&#160;&#160;&#160;if(x != NULL) { cudaFreeHost(x); x = NULL; }</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Check for non-NULL pointer before freeing it, and then set the pointer to NULL. </p>

</div>
</div>
<a id="ga83cbda41b1503ffc548dadc3a10e12af"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga83cbda41b1503ffc548dadc3a10e12af">&#9670;&nbsp;</a></span>CUDA_SUCCESS</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define CUDA_SUCCESS</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">x</td><td>)</td>
          <td>&#160;&#160;&#160;(<a class="el" href="group__cudaError.html#ga5af54ef2b094a11a88feb67b327e1d19">CUDA</a>(x) == cudaSuccess)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Evaluates to true on success. </p>

</div>
</div>
<a id="ga422e1f398e12cf567ed890a5b499eeef"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga422e1f398e12cf567ed890a5b499eeef">&#9670;&nbsp;</a></span>CUDA_VERIFY</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define CUDA_VERIFY</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">x</td><td>)</td>
          <td>&#160;&#160;&#160;if(<a class="el" href="group__cudaError.html#gad12b27627f04dd0ecf3eb9e2468a846e">CUDA_FAILED</a>(x))	return false;</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Return from the boolean function if CUDA call fails. </p>

</div>
</div>
<a id="gae6c4176aa6f8270000ec2b626a2a8b3c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gae6c4176aa6f8270000ec2b626a2a8b3c">&#9670;&nbsp;</a></span>LOG_CUDA</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define LOG_CUDA&#160;&#160;&#160;&quot;[cuda]   &quot;</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>LOG_CUDA string. </p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga1bab99bd137e538276d8c75a12779f61"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1bab99bd137e538276d8c75a12779f61">&#9670;&nbsp;</a></span>cudaCheckError()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">cudaError_t cudaCheckError </td>
          <td>(</td>
          <td class="paramtype">cudaError_t&#160;</td>
          <td class="paramname"><em>retval</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>txt</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>file</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>line</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>cudaCheckError </p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Tue Mar 28 2023 14:27:58 for Jetson Inference by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.17 </li>
  </ul>
</div>
</body>
</html>
